<?php
echo "123";
$time=time()+1;
setcookie("name","somebody",$time);
echo time()." and ".$time,"<br>",PHP_EOL;
echo "当前name的cookie是：".$_COOKIE["name"],"<br>",PHP_EOL;

?>

<html>
<body>
<!--    双击F5才有值，因为cookie只持续一秒，意味着第一次刷新设置了cookie，第二次刷新才能读到-->
    <?php if(isset($_COOKIE["name"]))
        echo "farewell ".$_COOKIE["name"]."！";
    else
        echo "farewell nobody！";?>
<br>
    <?php
    if(isset($_COOKIE["name"]))
        echo "farewell ".$_COOKIE["name"]."！";
    else
        echo "farewell nobody！";?>

</body>
</html>

<?php //setcookie("name","",time()-1);?>
